# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo4.29
# Description:  序列方法的操作
# Author:       98745
# Date:         2019/1/18
#-------------------------------------------------------------------------------

print("测试append方法")
numbers=[1,2,3,4]
numbers.append(5)
print(numbers)
numbers.append([6,7])
print(numbers)

print("测试clear方法")
names=['bill','mary','jack']
print(names)
names.clear();
print(names)

print("测试copy方法")
a=[1,2,3]
b=a
b[1]=30
print(a)
aa=[1,2,3]
bb=aa.copy()
bb[1]=30
print(aa)

search=['he','new','he','he','world','peter',[1,2,3],'ok',[1,2,3]]
print(search.count('he'))
print(search.count([1,2,3]))

a=[1,2,3]
b=[4,5,6]
a.extend(b)
print(a)

a=[1,2,3]
b=[4,5,6]
print(a+b)

a=[1,2,3]
b=[4,5,6]
a[len(a):]=b
print(a)


s=['i','love','python']
print(s.index('python'))

numbers=[1,2,3,4,5]
numbers.insert(3,'four')
print(numbers)

numbers=[1,2,3,4,5]
numbers[3:3]=['four']
print(numbers)

numbers=[1,2,3]
print(numbers.pop())
print(numbers.pop(0))
print(numbers)

words=['he','new','he','yes','bike']
words.remove('he')
print(words)

numbers=[5,4,1,7,4,2]
numbers.sort()
print(numbers)

x=[5,4,1,8,6]
y=x[:]
y.sort()
print(x)
print(y)

x=[7,6,4,8,5]
y=sorted(x)
print(x)
print(y)

print(sorted('geekori'))

x=[5,4,1,7,5]
x.sort(reverse=True)
print(x)


x=[3,4,2,4,3,7,6,8,0]
y=x
y.sort()
print(x)
print(y)



